<template>
    <div class="content">
        <h3 class="tatal">{{text.title}}</h3>
          <p class="subtitle">
                <span>发表时间 : {{text.add_time | time}}</span>
                <span>点击次数 : {{text.click}}</span>
          </p>
        <hr>
         <div class="contentlis" v-html="text.content"></div>
         
         <comment-box :id="this.id"></comment-box>
    </div>
</template>
<script>
// getnew
import {getnew} from "@/api/index.js";
import { Toast } from "mint-ui";
import theory from "../components/theory"
    export default {
       data(){
        return{
            id:this.$route.params.id,
            text:[]
        }
       },
       created(){
         this. getlist()
       },
       components:{
            "comment-box":theory
       },
       methods:{
           getlist(){
               getnew(this.id).then(res =>{              
                   if (res.status === 0) {
                        this.text = res.message[0];
                        } else {
                        Toast("加载新闻详情失败");
                    }
               })
           }
       }
    }
</script>
<style lang="scss" scoped>
.content{
     padding: 0 5px;
}
 .tatal {
    font-size: 16px;
    color: brown;
    text-align: center;
    margin: 10px 0;
  }
  .subtitle {
    font-size: 13px;
    color: #226aff;
    display: flex;
    justify-content: space-between;
  }
  .contentlis {
    /deep/ img {
      width: 100%;
    }
  }
</style>

